
import request from '@/utils/request'
// eslint-disable-next-line camelcase
const api_name = '/service_authority/admin/user'
export default {

  /* 获取用户分页数据 */
  getPageList(page:number, limit:number, searchObj:object) {
    return request({
      // eslint-disable-next-line camelcase
      url: `${api_name}/getPageUser/${page}/${limit}`,
      method: 'post',
      data: searchObj // url查询字符串或表单键值对
    })
  },
  /* 根据用户id查询用户 */
  getUserById(id:number) {
    return request({
      // eslint-disable-next-line camelcase
      url: `${api_name}/getUserById/${id}`,
      method: 'get'
    })
  },
  /**保存用户*/
  save(user:object) {
    return request({
      url: `${api_name}/saveUser`,
      method: 'post',
      data: user
    })
  },
  //!**更新用户*
  updateById(user:object) {
    return request({
      url: `${api_name}/updateUser`,
      method: 'post',
      data: user
    })
  },
//!**根据用户id查询用户下角色信息*!/
  getAssign(userId:object){
    return request({
      url: `${api_name}/getUserRoleData/${userId}`,
      method: 'get'
    })
  },
 // /!**保存用户角色信息*!/
  saveAssign(userId:string, roleId:number){
    return request({
      url: `${api_name}/doAssign`,
      method: 'post',
      params:{userId,roleId}
    })
  },
  //!**删除用户*!/
  removeById(id:number){
    return request({
      url: `${api_name}/removeUser/${id}`,
      method: 'post'
    })
  },
  //!**批量删除用户*!/
  removeRows(idList:Array<string>){
    return request({
      url: `${api_name}/removeUserByIds`,
      method: 'post',
      data:idList
    })
  }
}

